
// import _update from "./utils/_update";

import _openid from "./cache/_openid";
import _layer from "./common/_layer";
import lib_tiktok from "./api/lib_tiktok";

// app.js
App({
  onLaunch(data) {
    console.log(data.query, '启动参数');
    this.Login()
   
  },
  Login() {
    tt.login({
        success: res => {
            if (res.errMsg = "login:ok") {
              console.log(res.code, 'code');
              lib_tiktok.openid(res.code).then(response => {
                    if (response.code == 0) {
                        //缓存openid
                        _openid.set(response.data.openid)
                    } else {
                      _layer.message(response.msg)
                    }
                })
            } else {
                // _layer.message('未识别到用户身份，请授权')
            }
        },
        fail: err => {
            console.log(err);
           
        },
        complete: cpl => {
            // console.log(cpl);
        }
    })
},
  
});